#include "CircleOverlay.h"
#include <opencv2/imgproc/imgproc.hpp>

CircleOverlay::CircleOverlay(const cv::Scalar &color, const int &radius) : Filter(2, 1), color(color), radius(radius)
{
}


CircleOverlay::~CircleOverlay(void)
{
}

void CircleOverlay::Process()
{
	if (inputs[0]->channels() == 3)
	{
		outputs[0] = inputs[0]->clone();
	}
	else if (inputs[0]->channels() == 1)
	{
		cv::cvtColor(*inputs[0], outputs[0], CV_GRAY2BGR);
	}

	for (int i = 0; i < inputs[1]->rows; ++i)
	{
		cv::Point2i point;
		point.x = inputs[1]->at<int>(i, 0);
		point.y = inputs[1]->at<int>(i, 1);

		cv::circle(outputs[0], point, radius, color);
	}
}

void CircleOverlay::ProcessInvalid()
{
	outputs[0] = inputs[0]->clone();
}
